In [1]:
%%javascript 
$('.math>span').css("border-left-color","transparent")



In [33]:
%matplotlib inline

from __future__ import division

import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit

from calculate_from_DOS import *

plt.rcParams['figure.figsize'] = (10, 6)
plt.rcParams['font.size'] = 16
plt.rcParams['axes.labelsize'] = 16
plt.style.use('seaborn-notebook')


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-33-a150b8bb87e1> in <module>()
     13 plt.rcParams['axes.labelsize'] = 16
     14 plt.style.use('seaborn-notebook')
---> 15 plt.tight_layout()

/Users/benjamin/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in tight_layout(pad, h_pad, w_pad, rect)
   1377 
   1378     fig = gcf()
-> 1379     fig.tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
   1380 
   1381 

/Users/benjamin/anaconda/lib/python2.7/site-packages/matplotlib/figure.pyc in tight_layout(self, renderer, pad, h_pad, w_pad, rect)
   1752                                          renderer,
   1753                                          pad=pad, h_pad=h_pad, w_pad=w_pad,
-> 1754                                          rect=rect)
   1755 
   1756         self.subplots_adjust(**kwargs)

/Users/benjamin/anaconda/lib/python2.7/site-packages/matplotlib/tight_layout.py in get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, pad, h_pad, w_pad, rect)
    320         subplots.append(ax)
    321 
--> 322     max_nrows = max(nrows_list)
    323     max_ncols = max(ncols_list)
    324 

ValueError: max() arg is an empty sequence
<matplotlib.figure.Figure at 0x112031510>

In this notebook, we'll take a look at the Gaussian and Lorentzian broadened versions of the density of states, and perform standard Dingle plot analysis on them. We're concerned only with the low-temperature limit of the resistivity, which is proportional to the density of states at the fermi energy.


In [3]:
n_e = 3e15
E_f = E_fermi(n_e)
eps = generate_eps(0.1, 0.1, n_e)
E_f_index = np.where(eps>=E_f)[0][0]
tau_q = 1e-12

In [11]:
B_arr = np.linspace (0.1, 0.5, 2000)
D_g = np.array([generate_DOS(B, tau_q, eps, broadening='Gaussian')[1][E_f_index] for B in B_arr])
D_l = np.array([generate_DOS(B, tau_q, eps, broadening='Lorentzian')[1][E_f_index] for B in B_arr])

In [12]:
plt.plot(B_arr, D_g)
plt.plot(B_arr, D_l)


Out[12]:
[<matplotlib.lines.Line2D at 0x10dfe1950>]

In [40]:
def get_local_extrema(y):
    peaks = np.where((y[1:-1] > y[0:-2]) * (y[1:-1] > y[2:]))[0] + 1
    dips = np.where((y[1:-1] < y[0:-2]) * (y[1:-1] < y[2:]))[0] + 1
    
    return peaks, dips #x[peaks], y[peaks], x[dips], y[dips]

peaks_g, dips_g = get_local_extrema(D_g)
peaks_l, dips_l = get_local_extrema(D_l)

fig = plt.figure()
ax1 = fig.add_subplot(2,2,1)
plt.semilogy (1/B_arr[peaks_g], D_g[peaks_g]-1, 'o')
ax1.set_xlabel ('1/$B$')
ax1.set_title("Gaussian Broadening")

ax2 = fig.add_subplot(2,2,3)
plt.semilogy (1/B_arr[peaks_g]**2, D_g[peaks_g]-1, 'o')
ax2.set_xlabel ('1/$B^2$')

ax3 = fig.add_subplot(2,2,2)
plt.semilogy (1/B_arr[peaks_l], D_l[peaks_l]-1, 'o')
ax3.set_xlabel ('1/$B$')
ax3.set_title("Lorentzian Broadening")

ax4 = fig.add_subplot(2,2,4)
plt.semilogy (1/B_arr[peaks_l]**2, D_l[peaks_l]-1, 'o')
ax4.set_xlabel ('1/$B^2$')

for ax in [ax1,ax2, ax3, ax4]:
    ax.set_xlim (xmin = 0)
    ax.set_ylabel(r'$\Delta \rho / \rho$')

B2 = np.arange (0.1, 1000)
linear = lambda x, m, b: m*x + b   
params = curve_fit(linear, 1/B_arr[peaks_g]**2, np.log(D_g[peaks_g]-1))
m,b = params[0]
A = exp(b)
ax2.semilogy (1/B2**2, A * exp (m/B2**2))
print("Gaussian: A=$.2f"%A)


linear = lambda x, m, b: m*x + b   
params = curve_fit(linear, 1/B_arr[peaks_l], np.log(D_l[peaks_l]-1))
m,b = params[0]
A = exp(b)
ax3.semilogy (1/B2, A * exp (m/B2))
print("Lorentzian: A=$.2f"%A)
plt.tight_layout()


Gaussian: A=$.2f
Lorentzian: A=$.2f

The values of the intercepts on the linear fit are supposed to be 2 for Gaussian broadened DOS and 4 for Lorentzian-broadened.


In [ ]:


In [ ]: